package com.bestcem.xm.user.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 用户版本：【0：免费版、1：企业版】，默认1
 *
 * @author wangyunyun <yunyun.wang@idiaoyan.com>
 * @version v1.0
 * @date 2022/3/4 10:47
 */
@Getter
@AllArgsConstructor
public enum UserEditionEnum {

    FREE(0, "免费版"),
    ENTERPRISE(1, "企业版"),
    ;

    private final Integer type;

    private final String desc;

    /**
     * 通过type获取
     *
     * @param type
     * @return
     */
    public static UserEditionEnum getByType(Integer type) {
        if (type != null) {
            for (UserEditionEnum value : values()) {
                if (value.getType().equals(type)) {
                    return value;
                }
            }
        }
        return null;
    }

}
